<?php


if (empty($_POST) == FALSE) {

	$myFile = "testFile.txt";
	$fh = fopen($myFile, "a");

	$stringData = $_POST['deviceToken']."\n";
	
	fwrite($fh, $stringData);
	fclose($fh);
		
}

?>

<html>

<head>
<title>device token data</title>
</head>

<body>

	<div>
	
	
		<ul>
			<?php 
				$myFile = "testFile.txt";
				$fh = fopen($myFile, "r");
				$line = fgets($fh);
				while (empty($line) == false) {					
				
					echo "<li>".$line."</li>";
					$line = fgets($fh);
				}
				
				fclose($fh);
			
			?>		
		
		</ul>
	</div>
	
	<div>
	
		<form method="post">
		
			<div>
				<label for="deviceToken"> Enter Device Token to add</label>
				<input type="text" name="deviceToken" id="deviceToken"/>			
			</div>
			
			<div>
				<input type="submit" value="submit"/>
			</div>
			
		</form>
	
	</div>
</body>
</html>
